#ifndef ENDIAN_H
#define ENDIAN_H


//  These must be defined before 'pendian.h'.
//
#define endianBIG_ENDIAN		'E'
#define endianLITTLE_ENDIAN		'e'


#include "pendian.h"


#if (endianMACHINE == endianBIG_ENDIAN)
	#define endianLITERAL(a,b,c,d)		(((a)<<24)|((b)<<16)|((c)<<8)|(d))
#else
	#define endianLITERAL(a,b,c,d)		(((d)<<24)|((c)<<16)|((b)<<8)|(a))
#endif


#ifdef __cplusplus
namespace Endian
{
        int32 ReceiveInt4( int32* pI, uint8* pBuf );
        int32 SendInt4( int32 i, uint8* msgbuf );

        int32 ReceiveInt2( int16* pI, uint8* pBuf );
        int32 SendInt2( int16 i, uint8* pBuf );
        int32 ReceiveInt2( uint16* pI, uint8* pBuf );
        int32 SendInt2( uint16 i, uint8* pBuf );

		int32 ReceiveInt1( int8* pI, uint8* pBuf );
		int32 SendInt1( int8 i, uint8* pBuf );

		int32 ReceiveByte( uint8* pU, uint8* pBuf );
        int32 SendByte( uint8 u, uint8* pBuf );

		int32 ReceiveInt8( int64* pI, uint8* pBuf );
        int32 SendInt8( int64 i, uint8* msgbuf );
};
#endif

#endif
